// 谁叫你只给 checker.cpp 不给 checker.exe 的
// 不过 cpeditor 会出手编译 checker 的！

// 通过阅读 checker 可知此题不会无解。谁叫你不 ans.readInt 的，这样会更诈骗（

// time: 9.7 7:59 >> 8:40 give up >> 11:36 finished

#include <bits/stdc++.h>
// #include "testlib.h"

using namespace std;

const int N = 1000010;

int n, a[N], vis[N], fa[N];
vector<int> e[N];
queue<int> q;
// set<int> s;

struct INF {
	static const int N = 1 << 22;
	char buf[N], *p1 = buf, *p2 = buf;//[p1, p2)
	#define gc() (p1 == p2 ? (p2 = (p1 = buf) + fread(buf, 1, N, stdin), p1 == p2 ? EOF : *(p1++)) : *(p1++))
	int readInt() {
		// scanf("%d", &l); return l;
		int l = 0;
		char ch = gc();
		while (!isdigit(ch)) ch = gc();
		while (isdigit(ch))
			l = l * 10 + (ch ^ 48), ch = gc();
		return l;
	}
}inf;
// priority_queue<int> Q;
// set<int> Q;
int stk[N], top = 0;
int ans[N], idx1 = 0;

void add(int u) {
	ans[idx1++] = u, vis[u] = 2;
	for (int v : e[u]) if (v != fa[u]) vis[v] = 1;
}

int main(/*int argc, char* argv[]*/) {
  // registerTestlibCmd(argc, argv);
  freopen("choice.in", "r", stdin);
  freopen("choice.out", "w", stdout);
  n = inf.readInt();
  for (int i = 1; i < n; ++i) {
    int u = inf.readInt(), v = inf.readInt();
    e[u].emplace_back(v), e[v].emplace_back(u);
  }
  // cerr << clock() << "\n";//675 >> fread 399
  q.push(1);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : e[u]) {
      if (v == fa[u]) continue;
      fa[v] = u, q.push(v);
    }
  }
  // a[1] = ouf.readInt(-1, n);
  // if (a[1] <= 0) quitf(_wa, "You didn't find the solution.");
  // for (int i = 2; i <= n; ++i) a[i] = ouf.readInt(1, n);
  vis[1] = 1;// Q.emplace(1);
  // auto add = [](int u) {
  	// // printf("%d ", u);
  	// ans[idx1++] = u;
    // // if (vis[u] != 1) quitf(_wa, "Wrong answer.");
    // // assert(vis[u] == 1);
    // // if (s.find(fa[u]) != s.end()) s.erase(fa[u]);
    // /*s.insert(u), */vis[u] = 2; // /*Q.pop();*/ Q.erase(u);
    // // if (u != *prev(s.end())) quitf(_wa, "Wrong answer.");
    // // assert(u == *prev(s.end()));
    // for (int v : e[u]) if (v != fa[u]) vis[v] = 1;//, Q.emplace(/*u*/v);
  // };
  
  for (int i = 1; i <= n; ++i) {
  	// if(i != 1) cerr << (*prev(s.end()));
    // int u = /*a[i]*/ /*Q.top()*/ i == 1 ? 1 : *Q.upper_bound(*prev(s.end()));
    if(vis[i] == 2) continue;
    int u = i;
    while(!vis[u]) stk[top++] = u, u = fa[u];
    add(u);
    while(top) add(stk[--top]);
  }
  // quitf(_ok, "Accepted.");
  // cerr << clock() << "\n";//691
  for(int i = 0; i < n; i++) printf("%d ", ans[i]);
  // cerr << clock();//846
  
  // 哦开 o2 跑的飞快，那没事了。
  return 0;
}